$(document).ready(function(){
    var vm = new Vue({
        el: ".layoutWrapper",
        data: {
            totalPeopleNum:'',
            bpTestNum:'',
            bsTestNum:'',
            patientTotal:'',
            unUseTotal5:'',
            unUseTotal10:'',
            unUseTotal15:'',
            useTimes5:'',
            useTimes10:'',
            useTimes15:'',
            num:5,
            navActive:0,
            selectList:[],
            hospitalBar:[]
        },
        methods: {
            // floor1,floor3
            getData() {
                let that = this;
                $.ajax({
                    //todo
                    url: ctx + '/index/count1',
                    type: 'post',
                    async: true, //默认为true 异步
                    dataType: 'json',
                    error: function (data) {
                        alert('error');
                    },
                    success: function (res) {

                        if (res.data == null) {
                            return
                        } else {

                            that.bpTestNum = res.data.bpTestNum;
                            that.bsTestNum = res.data.bsTestNum;
                            that.unUseTotal5 = res.data.unUseTotal5;
                            that.unUseTotal10 = res.data.unUseTotal10;
                            that.unUseTotal15 = res.data.unUseTotal15;
                            that.useTimes5 = res.data.useTimes5;
                            that.useTimes10 = res.data.useTimes10;
                            that.useTimes15 = res.data.useTimes15;
                            that.totalPeopleNum = res.data.patientTotal;

                        }

                        // }
                    }

                })
            },
            cal(event, num, ref) {
                this.num = num;
                var target = event.target;
                var index = Number(target.getAttribute("data-index"));
                this.navActive = index;
            },
            // 获取select的option
            getOption() {
                let that = this;
                $.ajax({
                    //todo
                    url: ctx + '/index/count2',
                    type: 'post',
                    async: false, //默认为true 异步
                    dataType: 'json',
                    error: function (data) {
                        alert('error');
                    },
                    success: function (res) {
                        if (res.data == null) {
                            return
                        } else {
                            that.selectList = that.selectList.concat(res.data.hospitalPatientTotals);
                        }

                    }

                })
            },
            bsDetail(){
                console.log(888888);
                // showSrc('${URL_LAYOUT}')"

            }
            // get60age() {
            //     var selectId = [];
            //     var selectEle = [];
            //     selectEle = $('.ms-drop .selected input');
            //     for (var i = 0; i < selectEle.length; i++) {
            //         if (selectEle[i].id) {
            //             selectId.push(selectEle[i].id);
            //         }
            //     }
            //     var that = this;
            //     $.ajax({
            //         url: ctx + '/index/count3',
            //         type: 'post',
            //         async: true, //默认为true 异步
            //         data: {
            //             ids: selectId.toString()
            //         },
            //         dataType: 'json',
            //         error: function (data) {
            //             alert('error');
            //         },
            //         success: function (res) {
            //             that.bpNum = res.data.bpNum;
            //             that.bsNum = res.data.bsNum;
            //             that.bp60Num = res.data.bp60Num;
            //             that.bs60Num = res.data.bs60Num;
            //             that.manNum = res.data.manNum;
            //             that.womanNum = res.data.womanNum;
            //
            //         }
            //     });
            //
            //
            // }
        },
        created(){
            this.getData();
            this.getOption();
            // this.get60age();
        },
        mounted(){
            $('#hospital').change(function() {
            }).multipleSelect({
                width: '250px',
                id:'id'
            });
        }

    });
});
